package com.example.barcodeapp.ui.wode.fragment;

import android.content.Intent;

import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import com.example.barcodeapp.R;
import com.example.barcodeapp.base.BaseFragment;
import com.example.barcodeapp.interfaces.IBasePersenter;
import com.example.barcodeapp.ui.wode.activity.ParticularsActivity;
import com.example.barcodeapp.ui.wode.adapter.HomeAdapter4;
import com.example.barcodeapp.ui.wode.bean.DingDanBean;

import java.util.ArrayList;

import butterknife.BindView;

public class AllFragment2 extends BaseFragment {
    @BindView(R.id.rec_home123123)
    RecyclerView rec_home123123;

    private ArrayList<DingDanBean.DataBean> list;

    public AllFragment2(ArrayList<DingDanBean.DataBean> list) {
        this.list = list;
    }

    protected int getLayout() {
        return R.layout.all_fragment2;
    }

    @Override
    protected void initView() {
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
        rec_home123123.setLayoutManager(linearLayoutManager);
        HomeAdapter4 homeAdapter = new HomeAdapter4(context, list);
        rec_home123123.setAdapter(homeAdapter);
        homeAdapter.notifyDataSetChanged();
        homeAdapter.setOnItemClickListener(new HomeAdapter4.onItemClickListener() {
            @Override
            public void onItemClick(int position) {
                Intent intent = new Intent(getActivity(), ParticularsActivity.class);
                String ddnum = list.get(position).getDdnum();
                intent.putExtra("ddnum",ddnum);
                startActivity(intent);
            }
        });
    }

    @Override
    protected IBasePersenter initPersenter() {
        return null;
    }

    @Override
    protected void initData() {
    }
}